$(function() {
	/*获取number*/

	var number = getUrlParam("number");

	console.log("旅客人数--->" + number);

	if(number == '') {
		return;
	}
	//	getTraveller(number);

});

//获取url中的参数
function getUrlParam(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
	var r = window.location.search.substr(1).match(reg); //匹配目标参数
	if(r != null) return decodeURI(r[2]);
	return null; //返回参数值
}



function getTraveller(number) {
	var divs = '';
	for(var i = 1; i <= number; i++) {
		console.log("添加旅客--->" + i);
		/*旅客表单添加*/
		var div = '';
		div += '<div class="_2_9x3Ekhocib4PDfPf6Qkq">';
		div += '<p class="CVD8RvqJPLB40uw1ktUnc">';
		div += '<i class="zwui-iconfont zworld-icon-user"></i>';
		div += '<span>旅客信息' + i + '</span>';
		div += '</p>';
		div += '<div class="_3Y4ZJHq6kiYEOMc95wNK_j">';

		div += '<div class="zw-order-input zw-order-common col-2">';
		div += '<div id="surname">';
		div += '<label class="zw-order-input-title is-required">中文姓名</label>';
		div += '</div>';

		div += '<div class="zw-order-input-content zw-order-input-text">';
		div += ' <input type="text" name="firstname" placeholder="例李雷填李（同证件）" id="name_sur">';
		div += '</div>';
		div += '</div>';

		div += '<div class="zw-order-input zw-order-common col-2">';
		div += '<label class="zw-order-input-title is-required">性别</label>';
		div += '<div class="zw-order-input-content zw-order-input-radio">';
		div += ' <label>';
		div += '<span>&nbsp;&nbsp;</span>';
		div += '<input name="sex" type="radio" tabindex="-1" value="1">';
		div += '<span class="el-radio__label">男 </span>';
		div += '</label>';

		div += '<label>';
		div += '<span>&nbsp;&nbsp;</span>';
		div += '<input name="sex" type="radio" tabindex="-1" value="2">';
		div += '<span class="el-radio__label">女 </span>';
		div += '</label>';
		div += '</div>';
		div += '</div>';

		div += '<div class="zw-order-input zw-order-common col-2">';
		div += '<label class="zw-order-input-title is-required">出生日期</label>';
		div += '<div class="zw-order-input-content zw-order-input-date">';

		div += '<div class="card-body">';
		div += '<input class="form-control js-datepicker m-b-10" type="text" id="example-datepicker" name="example-datepicker" placeholder="" value="" data-date-format="yyyy-mm-dd" />';

		div += '</div>';

		div += '</div>';
		div += '</div>';

		div += '<div class="zw-order-input zw-order-common col-2">';
		div += '<div id="idCard">';
		div += '<label class="zw-order-input-title is-required">身份证号</label>';
		div += '</div>';

		div += '<div class="zw-order-input-content zw-order-input-text">';
		div += '<input type="text" name="identity_num" id="idCard_sur">';
		div += '</div>';
		div += '</div>';

		div += '<div class="zw-order-input zw-order-common col-2">';
		div += '<div id="phoneNumber">';
		div += '<label class="zw-order-input-title is-required">手机号</label>';
		div += '</div>';

		div += '<div class="zw-order-input-content zw-order-input-text">';
		div += '<input type="text" name="phone" id="phoneNumber_sur">';
		div += '</div>';
		div += '</div>';

		div += '</div>';
		div += '</div>';
		divs += div;
	}
	$("#traveller_number").html(divs);
}